package controller;

import interfaces.IFProduct;

import java.util.ArrayList;

import model.Product;
import db.ProductDb;

public class ProductCtr implements IFProduct {
	
	protected ProductDb productDb = new ProductDb();
	@Override
	public Product searchProduct(String name) throws Exception {
		return productDb.searchProduct(name);
	}
	@Override
	public ArrayList<Product> getAllProducts() throws Exception {
		return productDb.getAllProducts();
	}
	@Override
	public void insertProduct(String name, String description,
			double purchasePrice, double salesPrice, String countryOfOrigin,
			int minStock, int currentStock) {
		productDb.insertProduct(name, description, purchasePrice, salesPrice, countryOfOrigin, minStock, currentStock);
		
	}
	@Override
	public void removeProduct(String name) throws Exception {
		productDb.removeProduct(name);
	}
	
	@Override
	public void updateStock(int id, int qtty) throws Exception {
		productDb.updateStock(id, qtty);
	}

}
